package com.hr.牛客网剑指offer;

/**
 * @author zhz
 * @date 2020/09/22
 **/
public class JZ47_1_2_n {
    public int Sum_Solution(int n) {
        if (n == 0) {
            return 0;
        }
        int res=0;
        for (int i = 1; i <= n; i++) {
            res=res+i;
        }
        return res;
    }
    public int Sum_Solution1(int n) {
        if (n == 0) {
            return 0;
        }
        return n+Sum_Solution1(n-1);
    }
}
